package org.opens.entity.vo;

import lombok.Data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Data
public class LotteryHistoryTrend {

    private LotteryHistoryTrend() {
        // 禁止直接创建
    }

    private List<String> legendData;

    private List<String> xAxisData;

    private List<Integer> redNum1Arr;

    private List<Integer> redNum2Arr;

    private List<Integer> redNum3Arr;

    private List<Integer> redNum4Arr;

    private List<Integer> redNum5Arr;

    private List<Integer> redNum6Arr;

    private List<Integer> blueNumArr;

    private List<Integer> redNum1ModifyArr;

    private List<Integer> redNum2ModifyArr;

    private List<Integer> redNum3ModifyArr;

    private List<Integer> redNum4ModifyArr;

    private List<Integer> redNum5ModifyArr;

    private List<Integer> redNum6ModifyArr;

    private List<Integer> blueNumModifyArr;

    public static LotteryHistoryTrend build() {
        LotteryHistoryTrend result = new LotteryHistoryTrend();
        result.setLegendData(Arrays.asList("红球1", "红球2", "红球3", "红球4", "红球5", "红球6", "篮球"));
        result.setXAxisData(new ArrayList<>());
        result.setRedNum1Arr(new ArrayList<>());
        result.setRedNum2Arr(new ArrayList<>());
        result.setRedNum3Arr(new ArrayList<>());
        result.setRedNum4Arr(new ArrayList<>());
        result.setRedNum5Arr(new ArrayList<>());
        result.setRedNum6Arr(new ArrayList<>());
        result.setBlueNumArr(new ArrayList<>());

        result.setRedNum1ModifyArr(new ArrayList<>());
        result.setRedNum2ModifyArr(new ArrayList<>());
        result.setRedNum3ModifyArr(new ArrayList<>());
        result.setRedNum4ModifyArr(new ArrayList<>());
        result.setRedNum5ModifyArr(new ArrayList<>());
        result.setRedNum6ModifyArr(new ArrayList<>());
        result.setBlueNumModifyArr(new ArrayList<>());
        return result;
    }

    /**
     * 功能:
     * <pre>
     *     1. 由于数据库中需要优先去出最新的数据, 则需要按照某个字段desc排序, 但是这样取出的数据与echars中所需要表述的顺序相反, 因为人们跟习
     *     惯与从左往右是从小到大的顺序, 所以就需要反向处理一下.
     * </pre>
     */
    public void reverse() {
        Collections.reverse(this.getXAxisData());
        Collections.reverse(this.getRedNum1Arr());
        Collections.reverse(this.getRedNum2Arr());
        Collections.reverse(this.getRedNum3Arr());
        Collections.reverse(this.getRedNum4Arr());
        Collections.reverse(this.getRedNum5Arr());
        Collections.reverse(this.getRedNum6Arr());
        Collections.reverse(this.getBlueNumArr());

        Collections.reverse(this.getRedNum1ModifyArr());
        Collections.reverse(this.getRedNum2ModifyArr());
        Collections.reverse(this.getRedNum3ModifyArr());
        Collections.reverse(this.getRedNum4ModifyArr());
        Collections.reverse(this.getRedNum5ModifyArr());
        Collections.reverse(this.getRedNum6ModifyArr());
        Collections.reverse(this.getBlueNumModifyArr());
    }

}
